
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>ENTRYPOINT 入口点 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="env.html" />
    
    
    <link rel="prev" href="cmd.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../CHANGELOG.md">
            
                <span>
            
                    
                    修订记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../CONTRIBUTING.md">
            
                <span>
            
                    
                    如何贡献
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../introduction/">
            
                <a href="../../introduction/">
            
                    
                    Docker 简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../introduction/what.html">
            
                <a href="../../introduction/what.html">
            
                    
                    什么是 Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../introduction/why.html">
            
                <a href="../../introduction/why.html">
            
                    
                    为什么要用 Docker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../basic_concept/">
            
                <a href="../../basic_concept/">
            
                    
                    基本概念
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../basic_concept/image.html">
            
                <a href="../../basic_concept/image.html">
            
                    
                    镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../basic_concept/container.html">
            
                <a href="../../basic_concept/container.html">
            
                    
                    容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../../basic_concept/repository.html">
            
                <a href="../../basic_concept/repository.html">
            
                    
                    仓库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../install/">
            
                <a href="../../install/">
            
                    
                    安装 Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../install/ubuntu.html">
            
                <a href="../../install/ubuntu.html">
            
                    
                    Ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../install/debian.html">
            
                <a href="../../install/debian.html">
            
                    
                    Debian
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../install/fedora.html">
            
                <a href="../../install/fedora.html">
            
                    
                    Fedora
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../install/centos.html">
            
                <a href="../../install/centos.html">
            
                    
                    CentOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../install/raspberry-pi.html">
            
                <a href="../../install/raspberry-pi.html">
            
                    
                    Raspberry Pi
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../install/mac.html">
            
                <a href="../../install/mac.html">
            
                    
                    macOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../install/windows.html">
            
                <a href="../../install/windows.html">
            
                    
                    Windows 10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../../install/mirror.html">
            
                <a href="../../install/mirror.html">
            
                    
                    镜像加速器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../../install/experimental.html">
            
                <a href="../../install/experimental.html">
            
                    
                    开启实验特性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../">
            
                <a href="../">
            
                    
                    使用镜像
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../pull.html">
            
                <a href="../pull.html">
            
                    
                    获取镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../list.html">
            
                <a href="../list.html">
            
                    
                    列出镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../rm.html">
            
                <a href="../rm.html">
            
                    
                    删除本地镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../commit.html">
            
                <a href="../commit.html">
            
                    
                    利用 commit 理解镜像构成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../build.html">
            
                <a href="../build.html">
            
                    
                    使用 Dockerfile 定制镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="./">
            
                <a href="./">
            
                    
                    Dockerfile 指令详解
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.6.1" data-path="copy.html">
            
                <a href="copy.html">
            
                    
                    COPY 复制文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2" data-path="add.html">
            
                <a href="add.html">
            
                    
                    ADD 更高级的复制文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3" data-path="cmd.html">
            
                <a href="cmd.html">
            
                    
                    CMD 容器启动命令
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.7.6.4" data-path="entrypoint.html">
            
                <a href="entrypoint.html">
            
                    
                    ENTRYPOINT 入口点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.5" data-path="env.html">
            
                <a href="env.html">
            
                    
                    ENV 设置环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.6" data-path="arg.html">
            
                <a href="arg.html">
            
                    
                    ARG 构建参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.7" data-path="volume.html">
            
                <a href="volume.html">
            
                    
                    VOLUME 定义匿名卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.8" data-path="expose.html">
            
                <a href="expose.html">
            
                    
                    EXPOSE 暴露端口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.9" data-path="workdir.html">
            
                <a href="workdir.html">
            
                    
                    WORKDIR 指定工作目录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.10" data-path="user.html">
            
                <a href="user.html">
            
                    
                    USER 指定当前用户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.11" data-path="healthcheck.html">
            
                <a href="healthcheck.html">
            
                    
                    HEALTHCHECK 健康检查
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.12" data-path="onbuild.html">
            
                <a href="onbuild.html">
            
                    
                    ONBUILD 为他人作嫁衣裳
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.13" data-path="references.html">
            
                <a href="references.html">
            
                    
                    参考文档
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../multistage-builds/">
            
                <a href="../multistage-builds/">
            
                    
                    Dockerfile 多阶段构建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.7.1" data-path="../multistage-builds/laravel.html">
            
                <a href="../multistage-builds/laravel.html">
            
                    
                    实战多阶段构建 Laravel 镜像
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../manifest.html">
            
                <a href="../manifest.html">
            
                    
                    构建多种系统架构支持的 Docker 镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../other.html">
            
                <a href="../other.html">
            
                    
                    其它制作镜像的方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../internal.html">
            
                <a href="../internal.html">
            
                    
                    实现原理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../container/">
            
                <a href="../../container/">
            
                    
                    操作容器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../container/run.html">
            
                <a href="../../container/run.html">
            
                    
                    启动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../container/daemon.html">
            
                <a href="../../container/daemon.html">
            
                    
                    守护态运行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../../container/stop.html">
            
                <a href="../../container/stop.html">
            
                    
                    终止
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../../container/attach_exec.html">
            
                <a href="../../container/attach_exec.html">
            
                    
                    进入容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../../container/import_export.html">
            
                <a href="../../container/import_export.html">
            
                    
                    导出和导入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../../container/rm.html">
            
                <a href="../../container/rm.html">
            
                    
                    删除
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../../repository/">
            
                <a href="../../repository/">
            
                    
                    访问仓库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../../repository/dockerhub.html">
            
                <a href="../../repository/dockerhub.html">
            
                    
                    Docker Hub
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../../repository/registry.html">
            
                <a href="../../repository/registry.html">
            
                    
                    私有仓库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../../repository/registry_auth.html">
            
                <a href="../../repository/registry_auth.html">
            
                    
                    私有仓库高级配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../../repository/nexus3_registry.html">
            
                <a href="../../repository/nexus3_registry.html">
            
                    
                    Nexus 3
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../../data_management/">
            
                <a href="../../data_management/">
            
                    
                    数据管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../../data_management/volume.html">
            
                <a href="../../data_management/volume.html">
            
                    
                    数据卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../../data_management/bind-mounts.html">
            
                <a href="../../data_management/bind-mounts.html">
            
                    
                    挂载主机目录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../../network/">
            
                <a href="../../network/">
            
                    
                    使用网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../../network/port_mapping.html">
            
                <a href="../../network/port_mapping.html">
            
                    
                    外部访问容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../../network/linking.html">
            
                <a href="../../network/linking.html">
            
                    
                    容器互联
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../../network/dns.html">
            
                <a href="../../network/dns.html">
            
                    
                    配置 DNS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../../advanced_network/">
            
                <a href="../../advanced_network/">
            
                    
                    高级网络配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../../advanced_network/quick_guide.html">
            
                <a href="../../advanced_network/quick_guide.html">
            
                    
                    快速配置指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../../advanced_network/access_control.html">
            
                <a href="../../advanced_network/access_control.html">
            
                    
                    容器访问控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../../advanced_network/port_mapping.html">
            
                <a href="../../advanced_network/port_mapping.html">
            
                    
                    端口映射实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../../advanced_network/docker0.html">
            
                <a href="../../advanced_network/docker0.html">
            
                    
                    配置 docker0 网桥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../../advanced_network/bridge.html">
            
                <a href="../../advanced_network/bridge.html">
            
                    
                    自定义网桥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../../advanced_network/example.html">
            
                <a href="../../advanced_network/example.html">
            
                    
                    工具和示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../../advanced_network/config_file.html">
            
                <a href="../../advanced_network/config_file.html">
            
                    
                    编辑网络配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.8" data-path="../../advanced_network/ptp.html">
            
                <a href="../../advanced_network/ptp.html">
            
                    
                    实例：创建一个点到点连接
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../../buildx/">
            
                <a href="../../buildx/">
            
                    
                    Docker Buildx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../../buildx/buildkit.html">
            
                <a href="../../buildx/buildkit.html">
            
                    
                    BuildKit
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../../buildx/buildx.html">
            
                <a href="../../buildx/buildx.html">
            
                    
                    使用 buildx 构建镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../../buildx/multi-arch-images.html">
            
                <a href="../../buildx/multi-arch-images.html">
            
                    
                    使用 buildx 构建多种系统架构支持的 Docker 镜像
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../../compose/">
            
                <a href="../../compose/">
            
                    
                    Docker Compose
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../../compose/introduction.html">
            
                <a href="../../compose/introduction.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../../compose/install.html">
            
                <a href="../../compose/install.html">
            
                    
                    安装与卸载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../../compose/usage.html">
            
                <a href="../../compose/usage.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.4" data-path="../../compose/commands.html">
            
                <a href="../../compose/commands.html">
            
                    
                    命令说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.5" data-path="../../compose/compose_file.html">
            
                <a href="../../compose/compose_file.html">
            
                    
                    Compose 模板文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.6" data-path="../../compose/django.html">
            
                <a href="../../compose/django.html">
            
                    
                    实战 Django
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.7" data-path="../../compose/rails.html">
            
                <a href="../../compose/rails.html">
            
                    
                    实战 Rails
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.8" data-path="../../compose/wordpress.html">
            
                <a href="../../compose/wordpress.html">
            
                    
                    实战 WordPress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.9" data-path="../../compose/lnmp.html">
            
                <a href="../../compose/lnmp.html">
            
                    
                    实战 LNMP
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../../swarm_mode/">
            
                <a href="../../swarm_mode/">
            
                    
                    Swarm mode
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../../swarm_mode/overview.html">
            
                <a href="../../swarm_mode/overview.html">
            
                    
                    基本概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../../swarm_mode/create.html">
            
                <a href="../../swarm_mode/create.html">
            
                    
                    创建 Swarm 集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../../swarm_mode/deploy.html">
            
                <a href="../../swarm_mode/deploy.html">
            
                    
                    部署服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../../swarm_mode/stack.html">
            
                <a href="../../swarm_mode/stack.html">
            
                    
                    使用 compose 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.5" data-path="../../swarm_mode/secret.html">
            
                <a href="../../swarm_mode/secret.html">
            
                    
                    管理密钥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.6" data-path="../../swarm_mode/config.html">
            
                <a href="../../swarm_mode/config.html">
            
                    
                    管理配置信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.7" data-path="../../swarm_mode/rolling_update.html">
            
                <a href="../../swarm_mode/rolling_update.html">
            
                    
                    滚动升级
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../../security/">
            
                <a href="../../security/">
            
                    
                    安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../../security/kernel_ns.html">
            
                <a href="../../security/kernel_ns.html">
            
                    
                    内核命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../../security/control_group.html">
            
                <a href="../../security/control_group.html">
            
                    
                    控制组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" data-path="../../security/daemon_sec.html">
            
                <a href="../../security/daemon_sec.html">
            
                    
                    服务端防护
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4" data-path="../../security/kernel_capability.html">
            
                <a href="../../security/kernel_capability.html">
            
                    
                    内核能力机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5" data-path="../../security/other_feature.html">
            
                <a href="../../security/other_feature.html">
            
                    
                    其它安全特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.6" data-path="../../security/summary.html">
            
                <a href="../../security/summary.html">
            
                    
                    总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../../underly/">
            
                <a href="../../underly/">
            
                    
                    底层实现
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../../underly/arch.html">
            
                <a href="../../underly/arch.html">
            
                    
                    基本架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../../underly/namespace.html">
            
                <a href="../../underly/namespace.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.3" data-path="../../underly/cgroups.html">
            
                <a href="../../underly/cgroups.html">
            
                    
                    控制组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.4" data-path="../../underly/ufs.html">
            
                <a href="../../underly/ufs.html">
            
                    
                    联合文件系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5" data-path="../../underly/container_format.html">
            
                <a href="../../underly/container_format.html">
            
                    
                    容器格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.6" data-path="../../underly/network.html">
            
                <a href="../../underly/network.html">
            
                    
                    网络
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../../etcd/">
            
                <a href="../../etcd/">
            
                    
                    Etcd 项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" data-path="../../etcd/intro.html">
            
                <a href="../../etcd/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.2" data-path="../../etcd/install.html">
            
                <a href="../../etcd/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.3" data-path="../../etcd/cluster.html">
            
                <a href="../../etcd/cluster.html">
            
                    
                    集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.4" data-path="../../etcd/etcdctl.html">
            
                <a href="../../etcd/etcdctl.html">
            
                    
                    使用 etcdctl
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../../coreos/">
            
                <a href="../../coreos/">
            
                    
                    Fedora CoreOS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.19.1" data-path="../../coreos/intro.html">
            
                <a href="../../coreos/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19.2" data-path="../../coreos/install.html">
            
                <a href="../../coreos/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../../kubernetes/">
            
                <a href="../../kubernetes/">
            
                    
                    Kubernetes - 开源容器编排引擎
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.20.1" data-path="../../kubernetes/intro.html">
            
                <a href="../../kubernetes/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.2" data-path="../../kubernetes/concepts.html">
            
                <a href="../../kubernetes/concepts.html">
            
                    
                    基本概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.3" data-path="../../kubernetes/design.html">
            
                <a href="../../kubernetes/design.html">
            
                    
                    架构设计
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../../kubernetes/setup/">
            
                <a href="../../kubernetes/setup/">
            
                    
                    部署 Kubernetes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.21.1" data-path="../../kubernetes/setup/kubeadm.html">
            
                <a href="../../kubernetes/setup/kubeadm.html">
            
                    
                    使用 kubeadm 部署 kubernetes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21.2" data-path="../../kubernetes/setup/docker-desktop.html">
            
                <a href="../../kubernetes/setup/docker-desktop.html">
            
                    
                    在 Docker Desktop 使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21.3" data-path="../../kubernetes/setup/systemd.html">
            
                <a href="../../kubernetes/setup/systemd.html">
            
                    
                    一步步部署 kubernetes 集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21.4" data-path="../../kubernetes/setup/dashboard.html">
            
                <a href="../../kubernetes/setup/dashboard.html">
            
                    
                    部署 Dashboard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="../../kubernetes/kubectl/">
            
                <a href="../../kubernetes/kubectl/">
            
                    
                    Kubernetes 命令行 kubectl
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="../../cloud/">
            
                <a href="../../cloud/">
            
                    
                    容器与云计算
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.23.1" data-path="../../cloud/intro.html">
            
                <a href="../../cloud/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.2" data-path="../../cloud/tencentCloud.html">
            
                <a href="../../cloud/tencentCloud.html">
            
                    
                    腾讯云
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.3" data-path="../../cloud/alicloud.html">
            
                <a href="../../cloud/alicloud.html">
            
                    
                    阿里云
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.4" data-path="../../cloud/aws.html">
            
                <a href="../../cloud/aws.html">
            
                    
                    亚马逊云
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.5" data-path="../../cloud/summary.html">
            
                <a href="../../cloud/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.24" data-path="../../cases/os/">
            
                <a href="../../cases/os/">
            
                    
                    实战案例 - 操作系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.24.1" data-path="../../cases/os/busybox.html">
            
                <a href="../../cases/os/busybox.html">
            
                    
                    Busybox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.2" data-path="../../cases/os/alpine.html">
            
                <a href="../../cases/os/alpine.html">
            
                    
                    Alpine
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.3" data-path="../../cases/os/debian.html">
            
                <a href="../../cases/os/debian.html">
            
                    
                    Debian Ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.4" data-path="../../cases/os/centos.html">
            
                <a href="../../cases/os/centos.html">
            
                    
                    CentOS Fedora
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.5" data-path="../../cases/os/summary.html">
            
                <a href="../../cases/os/summary.html">
            
                    
                    本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.25" data-path="../../cases/ci/">
            
                <a href="../../cases/ci/">
            
                    
                    实战案例 - CI/CD
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.25.1" data-path="../../cases/ci/actions/">
            
                <a href="../../cases/ci/actions/">
            
                    
                    GitHub Actions
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.25.2" data-path="../../cases/ci/drone/">
            
                <a href="../../cases/ci/drone/">
            
                    
                    Drone
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.25.2.1" data-path="../../cases/ci/drone/install.html">
            
                <a href="../../cases/ci/drone/install.html">
            
                    
                    部署 Drone
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.25.3" data-path="../../cases/ci/travis/">
            
                <a href="../../cases/ci/travis/">
            
                    
                    Travis CI
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.26" data-path="../../IDE/">
            
                <a href="../../IDE/">
            
                    
                    在 IDE 中使用 Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.26.1" data-path="../../IDE/vsCode.html">
            
                <a href="../../IDE/vsCode.html">
            
                    
                    VS Code
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.27" data-path="../../opensource/">
            
                <a href="../../opensource/">
            
                    
                    Docker 开源项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.27.1" data-path="../../opensource/linuxkit.html">
            
                <a href="../../opensource/linuxkit.html">
            
                    
                    LinuxKit
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.28" data-path="../../podman/">
            
                <a href="../../podman/">
            
                    
                    podman - 下一代 Linux 容器工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29" data-path="../../appendix/">
            
                <a href="../../appendix/">
            
                    
                    附录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.29.1" data-path="../../appendix/faq/">
            
                <a href="../../appendix/faq/">
            
                    
                    附录一：常见问题总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2" data-path="../../appendix/repo/">
            
                <a href="../../appendix/repo/">
            
                    
                    附录二：热门镜像介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.29.2.1" data-path="../../appendix/repo/ubuntu.html">
            
                <a href="../../appendix/repo/ubuntu.html">
            
                    
                    Ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.2" data-path="../../appendix/repo/centos.html">
            
                <a href="../../appendix/repo/centos.html">
            
                    
                    CentOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.3" data-path="../../appendix/repo/nginx.html">
            
                <a href="../../appendix/repo/nginx.html">
            
                    
                    Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.4" data-path="../../appendix/repo/php.html">
            
                <a href="../../appendix/repo/php.html">
            
                    
                    PHP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.5" data-path="../../appendix/repo/nodejs.html">
            
                <a href="../../appendix/repo/nodejs.html">
            
                    
                    Node.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.6" data-path="../../appendix/repo/mysql.html">
            
                <a href="../../appendix/repo/mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.7" data-path="../../appendix/repo/wordpress.html">
            
                <a href="../../appendix/repo/wordpress.html">
            
                    
                    WordPress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.8" data-path="../../appendix/repo/mongodb.html">
            
                <a href="../../appendix/repo/mongodb.html">
            
                    
                    MongoDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.9" data-path="../../appendix/repo/redis.html">
            
                <a href="../../appendix/repo/redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.29.3" data-path="../../appendix/command/">
            
                <a href="../../appendix/command/">
            
                    
                    附录三：Docker 命令查询
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.29.3.1" data-path="../../appendix/command/docker.html">
            
                <a href="../../appendix/command/docker.html">
            
                    
                    客户端命令 - docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.3.2" data-path="../../appendix/command/dockerd.html">
            
                <a href="../../appendix/command/dockerd.html">
            
                    
                    服务端命令 - dockerd
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.29.4" data-path="../../appendix/best_practices.html">
            
                <a href="../../appendix/best_practices.html">
            
                    
                    附录四：Dockerfile 最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.5" data-path="../../appendix/debug.html">
            
                <a href="../../appendix/debug.html">
            
                    
                    附录五：如何调试 Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.6" data-path="../../appendix/resources.html">
            
                <a href="../../appendix/resources.html">
            
                    
                    附录六：资源链接
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.30" data-path="../../archive/">
            
                <a href="../../archive/">
            
                    
                    归档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.30.1" data-path="../../mesos/">
            
                <a href="../../mesos/">
            
                    
                    Mesos - 优秀的集群资源调度平台
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.30.1.1" data-path="../../mesos/intro.html">
            
                <a href="../../mesos/intro.html">
            
                    
                    Mesos 简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.2" data-path="../../mesos/installation.html">
            
                <a href="../../mesos/installation.html">
            
                    
                    安装与使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.3" data-path="../../mesos/architecture.html">
            
                <a href="../../mesos/architecture.html">
            
                    
                    原理与架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.4" data-path="../../mesos/configuration.html">
            
                <a href="../../mesos/configuration.html">
            
                    
                    Mesos 配置项解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.5" data-path="../../mesos/monitor.html">
            
                <a href="../../mesos/monitor.html">
            
                    
                    日志与监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.6" data-path="../../mesos/framework.html">
            
                <a href="../../mesos/framework.html">
            
                    
                    常见应用框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.7" data-path="../../mesos/summary.html">
            
                <a href="../../mesos/summary.html">
            
                    
                    本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.30.2" data-path="../../machine/">
            
                <a href="../../machine/">
            
                    
                    Docker Machine
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.30.2.1" data-path="../../machine/install.html">
            
                <a href="../../machine/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.2.2" data-path="../../machine/usage.html">
            
                <a href="../../machine/usage.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.30.3" data-path="../../swarm/">
            
                <a href="../../swarm/">
            
                    
                    Docker Swarm
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >ENTRYPOINT 入口点</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="entrypoint-&#x5165;&#x53E3;&#x70B9;">ENTRYPOINT &#x5165;&#x53E3;&#x70B9;</h3>
<p><code>ENTRYPOINT</code> &#x7684;&#x683C;&#x5F0F;&#x548C; <code>RUN</code> &#x6307;&#x4EE4;&#x683C;&#x5F0F;&#x4E00;&#x6837;&#xFF0C;&#x5206;&#x4E3A; <code>exec</code> &#x683C;&#x5F0F;&#x548C; <code>shell</code> &#x683C;&#x5F0F;&#x3002;</p>
<p><code>ENTRYPOINT</code> &#x7684;&#x76EE;&#x7684;&#x548C; <code>CMD</code> &#x4E00;&#x6837;&#xFF0C;&#x90FD;&#x662F;&#x5728;&#x6307;&#x5B9A;&#x5BB9;&#x5668;&#x542F;&#x52A8;&#x7A0B;&#x5E8F;&#x53CA;&#x53C2;&#x6570;&#x3002;<code>ENTRYPOINT</code> &#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4E5F;&#x53EF;&#x4EE5;&#x66FF;&#x4EE3;&#xFF0C;&#x4E0D;&#x8FC7;&#x6BD4; <code>CMD</code> &#x8981;&#x7565;&#x663E;&#x7E41;&#x7410;&#xFF0C;&#x9700;&#x8981;&#x901A;&#x8FC7; <code>docker run</code> &#x7684;&#x53C2;&#x6570; <code>--entrypoint</code> &#x6765;&#x6307;&#x5B9A;&#x3002;</p>
<p>&#x5F53;&#x6307;&#x5B9A;&#x4E86; <code>ENTRYPOINT</code> &#x540E;&#xFF0C;<code>CMD</code> &#x7684;&#x542B;&#x4E49;&#x5C31;&#x53D1;&#x751F;&#x4E86;&#x6539;&#x53D8;&#xFF0C;&#x4E0D;&#x518D;&#x662F;&#x76F4;&#x63A5;&#x7684;&#x8FD0;&#x884C;&#x5176;&#x547D;&#x4EE4;&#xFF0C;&#x800C;&#x662F;&#x5C06; <code>CMD</code> &#x7684;&#x5185;&#x5BB9;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x4F20;&#x7ED9; <code>ENTRYPOINT</code> &#x6307;&#x4EE4;&#xFF0C;&#x6362;&#x53E5;&#x8BDD;&#x8BF4;&#x5B9E;&#x9645;&#x6267;&#x884C;&#x65F6;&#xFF0C;&#x5C06;&#x53D8;&#x4E3A;&#xFF1A;</p>
<pre><code class="lang-bash">&lt;ENTRYPOINT&gt; <span class="hljs-string">&quot;&lt;CMD&gt;&quot;</span>
</code></pre>
<p>&#x90A3;&#x4E48;&#x6709;&#x4E86; <code>CMD</code> &#x540E;&#xFF0C;&#x4E3A;&#x4EC0;&#x4E48;&#x8FD8;&#x8981;&#x6709; <code>ENTRYPOINT</code> &#x5462;&#xFF1F;&#x8FD9;&#x79CD; <code>&lt;ENTRYPOINT&gt; &quot;&lt;CMD&gt;&quot;</code> &#x6709;&#x4EC0;&#x4E48;&#x597D;&#x5904;&#x4E48;&#xFF1F;&#x8BA9;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x51E0;&#x4E2A;&#x573A;&#x666F;&#x3002;</p>
<h4 id="&#x573A;&#x666F;&#x4E00;&#xFF1A;&#x8BA9;&#x955C;&#x50CF;&#x53D8;&#x6210;&#x50CF;&#x547D;&#x4EE4;&#x4E00;&#x6837;&#x4F7F;&#x7528;">&#x573A;&#x666F;&#x4E00;&#xFF1A;&#x8BA9;&#x955C;&#x50CF;&#x53D8;&#x6210;&#x50CF;&#x547D;&#x4EE4;&#x4E00;&#x6837;&#x4F7F;&#x7528;</h4>
<p>&#x5047;&#x8BBE;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4E00;&#x4E2A;&#x5F97;&#x77E5;&#x81EA;&#x5DF1;&#x5F53;&#x524D;&#x516C;&#x7F51; IP &#x7684;&#x955C;&#x50CF;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x5148;&#x7528; <code>CMD</code> &#x6765;&#x5B9E;&#x73B0;&#xFF1A;</p>
<pre><code class="lang-docker"><span class="hljs-keyword">FROM</span> ubuntu:<span class="hljs-number">18.04</span>
RUN apt-get update \
    &amp;&amp; apt-get install -y curl \
    &amp;&amp; rm -rf /var/lib/apt/lists/*
<span class="hljs-keyword">CMD</span> <span class="bash">[ <span class="hljs-string">&quot;curl&quot;</span>, <span class="hljs-string">&quot;-s&quot;</span>, <span class="hljs-string">&quot;https://ip.cn&quot;</span> ]
</span></code></pre>
<p>&#x5047;&#x5982;&#x6211;&#x4EEC;&#x4F7F;&#x7528; <code>docker build -t myip .</code> &#x6765;&#x6784;&#x5EFA;&#x955C;&#x50CF;&#x7684;&#x8BDD;&#xFF0C;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x67E5;&#x8BE2;&#x5F53;&#x524D;&#x516C;&#x7F51; IP&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x6267;&#x884C;&#xFF1A;</p>
<pre><code class="lang-bash">$ docker run myip
&#x5F53;&#x524D; IP&#xFF1A;61.148.226.66 &#x6765;&#x81EA;&#xFF1A;&#x5317;&#x4EAC;&#x5E02; &#x8054;&#x901A;
</code></pre>
<p>&#x55EF;&#xFF0C;&#x8FD9;&#x4E48;&#x770B;&#x8D77;&#x6765;&#x597D;&#x50CF;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x628A;&#x955C;&#x50CF;&#x5F53;&#x505A;&#x547D;&#x4EE4;&#x4F7F;&#x7528;&#x4E86;&#xFF0C;&#x4E0D;&#x8FC7;&#x547D;&#x4EE4;&#x603B;&#x6709;&#x53C2;&#x6570;&#xFF0C;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x5E0C;&#x671B;&#x52A0;&#x53C2;&#x6570;&#x5462;&#xFF1F;&#x6BD4;&#x5982;&#x4ECE;&#x4E0A;&#x9762;&#x7684; <code>CMD</code> &#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5B9E;&#x8D28;&#x7684;&#x547D;&#x4EE4;&#x662F; <code>curl</code>&#xFF0C;&#x90A3;&#x4E48;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x5E0C;&#x671B;&#x663E;&#x793A; HTTP &#x5934;&#x4FE1;&#x606F;&#xFF0C;&#x5C31;&#x9700;&#x8981;&#x52A0;&#x4E0A; <code>-i</code> &#x53C2;&#x6570;&#x3002;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x52A0; <code>-i</code> &#x53C2;&#x6570;&#x7ED9; <code>docker run myip</code> &#x4E48;&#xFF1F;</p>
<pre><code class="lang-bash">$ docker run myip -i
docker: Error response from daemon: invalid header field value <span class="hljs-string">&quot;oci runtime error: container_linux.go:247: starting container process caused \&quot;exec: \\\&quot;-i\\\&quot;: executable file not found in <span class="hljs-variable">$PATH</span>\&quot;\n&quot;</span>.
</code></pre>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x53EF;&#x6267;&#x884C;&#x6587;&#x4EF6;&#x627E;&#x4E0D;&#x5230;&#x7684;&#x62A5;&#x9519;&#xFF0C;<code>executable file not found</code>&#x3002;&#x4E4B;&#x524D;&#x6211;&#x4EEC;&#x8BF4;&#x8FC7;&#xFF0C;&#x8DDF;&#x5728;&#x955C;&#x50CF;&#x540D;&#x540E;&#x9762;&#x7684;&#x662F; <code>command</code>&#xFF0C;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x66FF;&#x6362; <code>CMD</code> &#x7684;&#x9ED8;&#x8BA4;&#x503C;&#x3002;&#x56E0;&#x6B64;&#x8FD9;&#x91CC;&#x7684; <code>-i</code> &#x66FF;&#x6362;&#x4E86;&#x539F;&#x6765;&#x7684; <code>CMD</code>&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x6DFB;&#x52A0;&#x5728;&#x539F;&#x6765;&#x7684; <code>curl -s https://ip.cn</code> &#x540E;&#x9762;&#x3002;&#x800C; <code>-i</code> &#x6839;&#x672C;&#x4E0D;&#x662F;&#x547D;&#x4EE4;&#xFF0C;&#x6240;&#x4EE5;&#x81EA;&#x7136;&#x627E;&#x4E0D;&#x5230;&#x3002;</p>
<p>&#x90A3;&#x4E48;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x5E0C;&#x671B;&#x52A0;&#x5165; <code>-i</code> &#x8FD9;&#x53C2;&#x6570;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x5FC5;&#x987B;&#x91CD;&#x65B0;&#x5B8C;&#x6574;&#x7684;&#x8F93;&#x5165;&#x8FD9;&#x4E2A;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-bash">$ docker run myip curl <span class="hljs-_">-s</span> https://ip.cn -i
</code></pre>
<p>&#x8FD9;&#x663E;&#x7136;&#x4E0D;&#x662F;&#x5F88;&#x597D;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x800C;&#x4F7F;&#x7528; <code>ENTRYPOINT</code> &#x5C31;&#x53EF;&#x4EE5;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x3002;&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x91CD;&#x65B0;&#x7528; <code>ENTRYPOINT</code> &#x6765;&#x5B9E;&#x73B0;&#x8FD9;&#x4E2A;&#x955C;&#x50CF;&#xFF1A;</p>
<pre><code class="lang-docker"><span class="hljs-keyword">FROM</span> ubuntu:<span class="hljs-number">18.04</span>
RUN apt-get update \
    &amp;&amp; apt-get install -y curl \
    &amp;&amp; rm -rf /var/lib/apt/lists/*
<span class="hljs-keyword">ENTRYPOINT</span> <span class="bash">[ <span class="hljs-string">&quot;curl&quot;</span>, <span class="hljs-string">&quot;-s&quot;</span>, <span class="hljs-string">&quot;https://ip.cn&quot;</span> ]
</span></code></pre>
<p>&#x8FD9;&#x6B21;&#x6211;&#x4EEC;&#x518D;&#x6765;&#x5C1D;&#x8BD5;&#x76F4;&#x63A5;&#x4F7F;&#x7528; <code>docker run myip -i</code>&#xFF1A;</p>
<pre><code class="lang-bash">$ docker run myip
&#x5F53;&#x524D; IP&#xFF1A;61.148.226.66 &#x6765;&#x81EA;&#xFF1A;&#x5317;&#x4EAC;&#x5E02; &#x8054;&#x901A;

$ docker run myip -i
HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Tue, 22 Nov 2016 05:12:40 GMT
Content-Type: text/html; charset=UTF-8
Vary: Accept-Encoding
X-Powered-By: PHP/5.6.24-1~dotdeb+7.1
X-Cache: MISS from cache-2
X-Cache-Lookup: MISS from cache-2:80
X-Cache: MISS from proxy-2_6
Transfer-Encoding: chunked
Via: 1.1 cache-2:80, 1.1 proxy-2_6:8006
Connection: keep-alive

&#x5F53;&#x524D; IP&#xFF1A;61.148.226.66 &#x6765;&#x81EA;&#xFF1A;&#x5317;&#x4EAC;&#x5E02; &#x8054;&#x901A;
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x8FD9;&#x6B21;&#x6210;&#x529F;&#x4E86;&#x3002;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x5F53;&#x5B58;&#x5728; <code>ENTRYPOINT</code> &#x540E;&#xFF0C;<code>CMD</code> &#x7684;&#x5185;&#x5BB9;&#x5C06;&#x4F1A;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x4F20;&#x7ED9; <code>ENTRYPOINT</code>&#xFF0C;&#x800C;&#x8FD9;&#x91CC; <code>-i</code> &#x5C31;&#x662F;&#x65B0;&#x7684; <code>CMD</code>&#xFF0C;&#x56E0;&#x6B64;&#x4F1A;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x4F20;&#x7ED9; <code>curl</code>&#xFF0C;&#x4ECE;&#x800C;&#x8FBE;&#x5230;&#x4E86;&#x6211;&#x4EEC;&#x9884;&#x671F;&#x7684;&#x6548;&#x679C;&#x3002;</p>
<h4 id="&#x573A;&#x666F;&#x4E8C;&#xFF1A;&#x5E94;&#x7528;&#x8FD0;&#x884C;&#x524D;&#x7684;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;">&#x573A;&#x666F;&#x4E8C;&#xFF1A;&#x5E94;&#x7528;&#x8FD0;&#x884C;&#x524D;&#x7684;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;</h4>
<p>&#x542F;&#x52A8;&#x5BB9;&#x5668;&#x5C31;&#x662F;&#x542F;&#x52A8;&#x4E3B;&#x8FDB;&#x7A0B;&#xFF0C;&#x4F46;&#x6709;&#x4E9B;&#x65F6;&#x5019;&#xFF0C;&#x542F;&#x52A8;&#x4E3B;&#x8FDB;&#x7A0B;&#x524D;&#xFF0C;&#x9700;&#x8981;&#x4E00;&#x4E9B;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;&#x3002;</p>
<p>&#x6BD4;&#x5982; <code>mysql</code> &#x7C7B;&#x7684;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x4E00;&#x4E9B;&#x6570;&#x636E;&#x5E93;&#x914D;&#x7F6E;&#x3001;&#x521D;&#x59CB;&#x5316;&#x7684;&#x5DE5;&#x4F5C;&#xFF0C;&#x8FD9;&#x4E9B;&#x5DE5;&#x4F5C;&#x8981;&#x5728;&#x6700;&#x7EC8;&#x7684; mysql &#x670D;&#x52A1;&#x5668;&#x8FD0;&#x884C;&#x4E4B;&#x524D;&#x89E3;&#x51B3;&#x3002;</p>
<p>&#x6B64;&#x5916;&#xFF0C;&#x53EF;&#x80FD;&#x5E0C;&#x671B;&#x907F;&#x514D;&#x4F7F;&#x7528; <code>root</code> &#x7528;&#x6237;&#x53BB;&#x542F;&#x52A8;&#x670D;&#x52A1;&#xFF0C;&#x4ECE;&#x800C;&#x63D0;&#x9AD8;&#x5B89;&#x5168;&#x6027;&#xFF0C;&#x800C;&#x5728;&#x542F;&#x52A8;&#x670D;&#x52A1;&#x524D;&#x8FD8;&#x9700;&#x8981;&#x4EE5; <code>root</code> &#x8EAB;&#x4EFD;&#x6267;&#x884C;&#x4E00;&#x4E9B;&#x5FC5;&#x8981;&#x7684;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;&#xFF0C;&#x6700;&#x540E;&#x5207;&#x6362;&#x5230;&#x670D;&#x52A1;&#x7528;&#x6237;&#x8EAB;&#x4EFD;&#x542F;&#x52A8;&#x670D;&#x52A1;&#x3002;&#x6216;&#x8005;&#x9664;&#x4E86;&#x670D;&#x52A1;&#x5916;&#xFF0C;&#x5176;&#x5B83;&#x547D;&#x4EE4;&#x4F9D;&#x65E7;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>root</code> &#x8EAB;&#x4EFD;&#x6267;&#x884C;&#xFF0C;&#x65B9;&#x4FBF;&#x8C03;&#x8BD5;&#x7B49;&#x3002;</p>
<p>&#x8FD9;&#x4E9B;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;&#x662F;&#x548C;&#x5BB9;&#x5668; <code>CMD</code> &#x65E0;&#x5173;&#x7684;&#xFF0C;&#x65E0;&#x8BBA; <code>CMD</code> &#x4E3A;&#x4EC0;&#x4E48;&#xFF0C;&#x90FD;&#x9700;&#x8981;&#x4E8B;&#x5148;&#x8FDB;&#x884C;&#x4E00;&#x4E2A;&#x9884;&#x5904;&#x7406;&#x7684;&#x5DE5;&#x4F5C;&#x3002;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x53EF;&#x4EE5;&#x5199;&#x4E00;&#x4E2A;&#x811A;&#x672C;&#xFF0C;&#x7136;&#x540E;&#x653E;&#x5165; <code>ENTRYPOINT</code> &#x4E2D;&#x53BB;&#x6267;&#x884C;&#xFF0C;&#x800C;&#x8FD9;&#x4E2A;&#x811A;&#x672C;&#x4F1A;&#x5C06;&#x63A5;&#x5230;&#x7684;&#x53C2;&#x6570;&#xFF08;&#x4E5F;&#x5C31;&#x662F; <code>&lt;CMD&gt;</code>&#xFF09;&#x4F5C;&#x4E3A;&#x547D;&#x4EE4;&#xFF0C;&#x5728;&#x811A;&#x672C;&#x6700;&#x540E;&#x6267;&#x884C;&#x3002;&#x6BD4;&#x5982;&#x5B98;&#x65B9;&#x955C;&#x50CF; <code>redis</code> &#x4E2D;&#x5C31;&#x662F;&#x8FD9;&#x4E48;&#x505A;&#x7684;&#xFF1A;</p>
<pre><code class="lang-docker"><span class="hljs-keyword">FROM</span> alpine:<span class="hljs-number">3.4</span>
...
<span class="hljs-keyword">RUN</span> <span class="bash">addgroup -S redis &amp;&amp; adduser -S -G redis redis
</span>...
<span class="hljs-keyword">ENTRYPOINT</span> <span class="bash">[<span class="hljs-string">&quot;docker-entrypoint.sh&quot;</span>]
</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">6379</span>
CMD [ <span class="hljs-string">&quot;redis-server&quot;</span> ]
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5176;&#x4E2D;&#x4E3A;&#x4E86; redis &#x670D;&#x52A1;&#x521B;&#x5EFA;&#x4E86; redis &#x7528;&#x6237;&#xFF0C;&#x5E76;&#x5728;&#x6700;&#x540E;&#x6307;&#x5B9A;&#x4E86; <code>ENTRYPOINT</code> &#x4E3A; <code>docker-entrypoint.sh</code> &#x811A;&#x672C;&#x3002;</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/sh</span>
...
<span class="hljs-comment"># allow the container to be started with `--user`</span>
<span class="hljs-keyword">if</span> [ <span class="hljs-string">&quot;<span class="hljs-variable">$1</span>&quot;</span> = <span class="hljs-string">&apos;redis-server&apos;</span> <span class="hljs-_">-a</span> <span class="hljs-string">&quot;<span class="hljs-variable">$(id -u)</span>&quot;</span> = <span class="hljs-string">&apos;0&apos;</span> ]; <span class="hljs-keyword">then</span>
    chown -R redis .
    <span class="hljs-built_in">exec</span> su-exec redis <span class="hljs-string">&quot;<span class="hljs-variable">$0</span>&quot;</span> <span class="hljs-string">&quot;<span class="hljs-variable">$@</span>&quot;</span>
<span class="hljs-keyword">fi</span>

<span class="hljs-built_in">exec</span> <span class="hljs-string">&quot;<span class="hljs-variable">$@</span>&quot;</span>
</code></pre>
<p>&#x8BE5;&#x811A;&#x672C;&#x7684;&#x5185;&#x5BB9;&#x5C31;&#x662F;&#x6839;&#x636E; <code>CMD</code> &#x7684;&#x5185;&#x5BB9;&#x6765;&#x5224;&#x65AD;&#xFF0C;&#x5982;&#x679C;&#x662F; <code>redis-server</code> &#x7684;&#x8BDD;&#xFF0C;&#x5219;&#x5207;&#x6362;&#x5230; <code>redis</code> &#x7528;&#x6237;&#x8EAB;&#x4EFD;&#x542F;&#x52A8;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5426;&#x5219;&#x4F9D;&#x65E7;&#x4F7F;&#x7528; <code>root</code> &#x8EAB;&#x4EFD;&#x6267;&#x884C;&#x3002;&#x6BD4;&#x5982;&#xFF1A;</p>
<pre><code class="lang-bash">$ docker run -it redis id
uid=0(root) gid=0(root) groups=0(root)
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="cmd.html" class="navigation navigation-prev " aria-label="Previous page: CMD 容器启动命令">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="env.html" class="navigation navigation-next " aria-label="Next page: ENV 设置环境变量">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"ENTRYPOINT 入口点","level":"1.7.6.4","depth":3,"next":{"title":"ENV 设置环境变量","level":"1.7.6.5","depth":3,"path":"image/dockerfile/env.md","ref":"image/dockerfile/env.md","articles":[]},"previous":{"title":"CMD 容器启动命令","level":"1.7.6.3","depth":3,"path":"image/dockerfile/cmd.md","ref":"image/dockerfile/cmd.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"image/dockerfile/entrypoint.md","mtime":"2020-04-12T12:29:28.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-23T10:39:04.870Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

